<?php
Load::lib('session');
if (Session::unset_data('pais') == null) {
    $url = "http://api.ipinfodb.com/v2/ip_query.php?key=17c077a658774e3b40a4bdf121994c5d3e91a3a7d27782ac80d6417f2f62ed64&ip=" . General::getIP() . "&timezone=false";
    $xml = file_get_contents($url);
    $obj = simplexml_load_string($xml);
    $pais = strtolower($obj->CountryCode);
    Session::set('pais', $pais);
}
//empiesa la publicidad
if ($tipo == "adjal-video" && $tamanio == "300*250") {
    //if ($pais == "es") {
    if (Session::get('pais') == "es") {
        ?>
        <a href="http://track.adjal.com/aff_c?offer_id=2210&aff_id=12750&file_id=146764" target="_blank">
            <img src="http://media.adjal.com/brand/files/adjal/2210/300x250-descargas.gif" width="300" height="250" border="1" />
        </a>
        <img src="http://track.adjal.com/aff_i?offer_id=2210&aff_id=12750&file_id=146764" width="1" height="1">
        <?php
    } else {
        ?>
        <!-- CODIGO ADPV -->
        <div id="adsadpv19171"></div>
        <script type="text/javascript"><!--
            var adpv_client = "19171";
            var adpv_width = 300;
            var adpv_height = 250;
            var adpv_container_id = "adsadpv19171";
            //--></script>
        <script type="text/javascript" src="http://ads.adpv.com/ads.js"></script>
        <!-- FIN CODIGO ADPV -->
        <?php
    }
} elseif ($tipo == "adjal-descarga" && $tamanio == "300*250") {
    if (Session::get('pais') == "es") {
        ?>
        <a href="http://track.adjal.com/aff_c?offer_id=1752&aff_id=12750&file_id=116732" target="_blank">
            <img src="http://media.adjal.com/brand/files/adjal/1388/Descarga_iHunt_ES_300x250.jpg" width="300" height="250" border="1" />
        </a>
        <img src="http://track.adjal.com/aff_i?offer_id=1752&aff_id=12750&file_id=116732" width="1" height="1">
        <?php
    } else {
        ?>
        <!-- CODIGO ADPV -->
        <div id="adsadpv19171"></div>
        <script type="text/javascript"><!--
            var adpv_client = "19171";
            var adpv_width = 300;
            var adpv_height = 250;
            var adpv_container_id = "adsadpv19171";
            //--></script>
        <script type="text/javascript" src="http://ads.adpv.com/ads.js"></script>
        <!-- FIN CODIGO ADPV -->
        <?php
    }
} elseif ($tipo == "adjal-descarga" && $tamanio == "300*250") {
    if (Session::get('pais') == "es") {
        ?>
        <a href="http://track.adjal.com/aff_c?offer_id=1708&aff_id=12750&file_id=115544" target="_blank"><img src="http://media.adjal.com/brand/files/adjal/1708/test-ci-728x90.gif" width="728" height="90" border="0" /></a><img src="http://track.adjal.com/aff_i?offer_id=1708&aff_id=12750&file_id=115544" width="1" height="1">
        <?php
    } else {
        ?>
        <!-- BEGIN SMOWTION TAG - 728x90 - DO NOT MODIFY -->
        <script type="text/javascript"><!--
            smowtion_size = "728x90";
            smowtion_section = "3479186";
            //-->
        </script>
        <script type="text/javascript"
                src="http://ads.smowtion.com/ad.js?s=3479186&amp;z=728x90">
        </script>
        <!-- END SMOWTION TAG - 728x90 - DO NOT MODIFY -->
        <?php
    }
} elseif ($tipo == "adjal-principal" && $tamanio == "728*290") {
    if (Session::get('pais') == "es") {
        ?>
        <a href="http://track.adjal.com/aff_c?offer_id=1708&aff_id=12750&file_id=115544" target="_blank">
            <img src="http://media.adjal.com/brand/files/adjal/1708/test-ci-728x90.gif" width="728" height="90" border="0" />
        </a>
        <img src="http://track.adjal.com/aff_i?offer_id=1708&aff_id=12750&file_id=115544" width="1" height="1">
        <?php
    } else {
        ?>
        <!-- BEGIN SMOWTION TAG - 728x90 - DO NOT MODIFY -->
        <script type="text/javascript"><!--
            smowtion_size = "728x90";
            smowtion_section = "3479186";
            //-->
        </script>
        <script type="text/javascript"
                src="http://ads.smowtion.com/ad.js?s=3479186&amp;z=728x90">
        </script>
        <!-- END SMOWTION TAG - 728x90 - DO NOT MODIFY -->
        <?php
    }
}
?>
